import * as echarts from "echarts";
import ReactECharts from "echarts-for-react";
import React from "react";
const RainEcharts = (props) => {
  const option = {
    grid: {
      left: "3%", //grid 组件离容器左侧的距离。
      right: "4%", //grid 组件离容器右侧的距离。
      top: "20%", //grid 组件离容器下侧的距离。
      bottom: "3%", //grid 组件离容器下侧的距离
      containLabel: true, //grid 区域是否包含坐标轴的刻度标签[ default: false ]
    },
    xAxis: [
      {
        type: "category",
        axisTick: {
          show: false, //是否显示坐标轴刻度
        },
        boundaryGap: false, //坐标轴两边留白策略，类目轴和非类目轴的设置和表现不一样
        axisLine: {
          lineStyle: {
            color: "#F1F1F3", //坐标轴线线的颜色。
          },
        },
        axisLabel: {
          textStyle: {
            fontSize: 10, //文字的字体大小
          },
        },
        data: ["00:00", "03:00 ", "06:00", "09:00 ", "12:00"],
      },
    ],
    yAxis: [
      {
        type: "value", //坐标轴类型。'value' 数值轴，适用于连续数据;'category' 类目轴，适用于离散的类目数据，为该类型时必须通过 data 设置类目数据;'time' 时间轴;'log' 对数轴.
        name: "降雨量（mm）", //坐标轴名称。
        axisTick: {
          show: false, //是否显示坐标轴刻度
        },
        axisLine: {
          lineStyle: {
            color: "#F1F1F3", //坐标轴线线的颜色
          },
        },
        axisLabel: {
          margin: 10, //刻度标签与轴线之间的距离
          textStyle: {
            fontSize: 12, //文字的字体大小
          },
        },
        splitLine: {
          lineStyle: {
            color: "#57617B", //分隔线颜色设置
          },
        },
      },
    ],
    series: [
      {
        type: "line",
        smooth: true,
        symbol: "circle",
        symbolSize: 5,
        showSymbol: false,
        lineStyle: {
          normal: {
            width: 1,
          },
        },
        areaStyle: {
          normal: {
            color: new echarts.graphic.LinearGradient(
              0,
              0,
              0,
              1,
              [
                {
                  offset: 0,
                  color: "rgba(0, 136, 212, 0.3)",
                },
                {
                  offset: 0.8,
                  color: "rgba(0, 136, 212, 0)",
                },
              ],
              false
            ),
            shadowColor: "rgba(0, 0, 0, 0.1)",
            shadowBlur: 10,
          },
        },
        itemStyle: {
          normal: {
            color: "rgb(0,136,212)",
            borderColor: "rgba(0,136,212,0.2)",
            borderWidth: 12,
          },
        },
        data: [100, 220, 210, 200, 300],
      },
    ],
  };

  return (
    <ReactECharts
      option={option}
      style={{
        height: "150px",
        width: "100%",
      }}
    />
  );
};

export default RainEcharts;
